﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace translator
{
    public class StringDownKeyDownCommand : ICommand
    {
        MainWindow mainWindow;

        public StringDownKeyDownCommand(MainWindow mainWindow)
        {
            this.mainWindow = mainWindow;
        }

        public event EventHandler CanExecuteChanged;

        public bool CanExecute(object parameter)
        {
            if (mainWindow.Datagrid.SelectedIndex == -1) { return false; }
            return true;
        }

        public void Execute(object parameter)
        {
            if (mainWindow.Datagrid.SelectedIndex+1 != mainWindow.Datagrid.Items.Count) mainWindow.Datagrid.SelectedIndex += 1;
            mainWindow.Datagrid.ScrollIntoView(mainWindow.Datagrid.SelectedItem);
        }
    }
}
